<extend name="Public/base" />

<block name="body">
    <form method="POST" id="poor" action="{:U('Report/poorExport')}">
        <!-- 标题栏 -->
        <div class="main-title">
            <h2>
                退单产品统计
                <a onclick="poor();" class="btn confirm btn-default">明细数据excel导出</a>
            </h2>
        </div>
        
        <div class="navbar navbar-default" style="margin: 0px;">
         
            <!-- 高级搜索 -->
            <div class="search-form " style="margin-top: 10px;margin-left: 10px;">
                <div class="sleft">
                   统计月份：
                </div>
                <div class="sleft">
                   <select name="report_mon" id="report_mon" class="search-input" style="height: 30px;width:90px">
                        <volist name="data.monList" id="vo">
                            <if condition="($vo.report_mon == $report_mon)">
                                <option value="{$vo.report_mon}" selected="selected">{$vo.report_mon}</option>
                                <else/>
                                <option value="{$vo.report_mon}">{$vo.report_mon}</option>
                            </if>
                        </volist>
                    </select>
                </div>
                <div class="sleft">
                    <a class="sch-btn" href="javascript:;" id="search" url="{:U('poor')}"><i class="btn-search"></i></a>
                </div>
            </div>
           
        </div>
       
        <!-- 数据列表 -->

        <div class="data-table table-striped">

            <table class="table table-hover">
                <thead>
                    <tr>            
                        <th style = "width:25%">产品名称</th>
                        <th>日期</th>
                        <th>总单数</th>
                        <th>出现单数</th>
                        <th>总天数</th>
                        <th>概率</th>
                    </tr>
                </thead>
                <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr  valign="top">
                            <td>{$vo.pname}{$vo.specname} </td>
                            <td>{$vo.report_day} </td>
                            <td>{$vo.tcnt} </td>	
                            <td>{$vo.cnt} </td>
                            <td>{$vo.days} </td>
                            <td>{$vo['cnt'] / $vo['days'] * 100|substr=0,4}% </td>
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="12" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </table>
        </div>
        <div class="page">
            {$_page}
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');

            var query = $('.search-form').find('input').serialize();
            var queryselect = $('.search-form').find('select').serialize();

            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            queryselect = queryselect.replace(/^&/g, '');

            if (url.indexOf('?') > 0) {
                url += '&' + query;
                url += '&' + queryselect;
            } else {
                url += '?' + query;
                url += '?' + queryselect;
            }

            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav('{:U('Report/poor')}');
        
        function poor(){
            $('#poor').submit();
        }
    </script>
</block>